//package com.mocha.bss.config;
//
//import lombok.Getter;
//import lombok.Setter;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.InitializingBean;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.cloud.context.config.annotation.RefreshScope;
//import org.springframework.stereotype.Component;
//
//import java.util.ArrayList;
//import java.util.List;
//import java.util.regex.Pattern;
//
///**
// * @author songkui
// * @since 2025-4-17
// * <p>
// * 资源服务器对外直接暴露URL,如果设置contex-path 要特殊处理
// */
//@Setter
//@Getter
//@Slf4j
//@Component
//@RefreshScope
//@ConfigurationProperties("security.oauth2.ignore")
//public class PermitUrl2Properties implements InitializingBean {
//
//	private static final Pattern PATTERN = Pattern.compile("\\{(.*?)\\}");
//
//	private static final String[] DEFAULT_IGNORE_URLS = new String[] { "/actuator/**", "/error", "/v3/api-docs" };
//
//	private List<String> urls = new ArrayList<>();
//
//	@Override
//	public void afterPropertiesSet() throws Exception {
//		log.info("--------PermitUrlProperties:----afterPropertiesSet------------------");
//	}
//
////	@Override
////	public void afterPropertiesSet() {
////		urls.addAll(Arrays.asList(DEFAULT_IGNORE_URLS));
////		RequestMappingHandlerMapping mapping = SpringUtil.getBean("requestMappingHandlerMapping");
////		Map<RequestMappingInfo, HandlerMethod> map = mapping.getHandlerMethods();
////
////		map.keySet().forEach(info -> {
////			HandlerMethod handlerMethod = map.get(info);
////
////			// 获取方法上边的注解 替代path variable 为 *
////			Inner method = AnnotationUtils.findAnnotation(handlerMethod.getMethod(), Inner.class);
////			Optional.ofNullable(method)
////				.ifPresent(inner -> Objects.requireNonNull(info.getPathPatternsCondition())
////					.getPatternValues()
////					.forEach(url -> urls.add(ReUtil.replaceAll(url, PATTERN, "*"))));
////
////			// 获取类上边的注解, 替代path variable 为 *
////			Inner controller = AnnotationUtils.findAnnotation(handlerMethod.getBeanType(), Inner.class);
////			Optional.ofNullable(controller)
////				.ifPresent(inner -> Objects.requireNonNull(info.getPathPatternsCondition())
////					.getPatternValues()
////					.forEach(url -> urls.add(ReUtil.replaceAll(url, PATTERN, "*"))));
////		});
////	}
//
//}
